# Maintainer: leso-kn <info@lesosoftware.com>
pkgname=piper-tts
_pkgver=2023.11.14-2
pkgver=${_pkgver/-/.}
pkgrel=0
pkgdesc="Fast, local neural text to speech system"
url="https://github.com/rhasspy/piper"
provides="larynx2=$pkgver-r$pkgrel"
replaces=larynx2
# x86, s390x: not supported by onnxruntime
arch="all !x86 !s390x"
license="MIT"
depends_dev="
	espeak-ng-dev
	onnxruntime-dev
	piper-phonemize-dev
	"
makedepends="
	$depends_dev
	cmake
	pcaudiolib-dev
	samurai
	spdlog-dev
	"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/rhasspy/piper/archive/refs/tags/$_pkgver.tar.gz
	no-rpath.patch
	use-system-libs.patch
	"
builddir="$srcdir"/piper-$_pkgver

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	install -Dm755 build/piper \
		-t "$pkgdir"/usr/bin/

	mkdir -p "$pkgdir"/usr/include/piper
	cp -a src/cpp/*.h src/cpp/*.hpp src/cpp/utf8/ "$pkgdir"/usr/include/piper/
}

sha512sums="
2156c8d384aafc977a41eea181855b5e3fddab1eca353528d919d421958e4c10dbcf6526d03433e4246ac847a2fe4a7c43a57d2cb5666993ad0f28ed9fb68fe6  piper-tts-2023.11.14.2.tar.gz
60c3233dd281c7a73077bca2c191c095ac7447cda34018c085fb08f5866d785d13bf5099a25d3803fa78215c2e3e73b6671349a0446286a6ec808335dcaa8808  no-rpath.patch
efdfca4f782d2be2bbb623496df9f5be1528d85abffeb85298ec823724b69c73e8a287e614f1ff79c1445d14fcb46347b04c2e0ff0f8a58b3d156933ec453e6a  use-system-libs.patch
"
